const express=require('express');
const path=require('path');
const fs=require('fs');

const app=express();

const router=require('./router/router.js');

const bodyParser=require('body-parser');

const record_log=require('./modules/log.js');

const session=require('express-session');

app .set('view engine','ejs')
    .set ('views','public')
    .use(bodyParser.urlencoded({extended:false}))
    .use(record_log)
    .use(session({
        secret: 'keyboard cat', // 相当于是一个加密密钥，值可以是任意字符串
        resave: false, // 强制session保存到session store中
        saveUninitialized: false // 强制没有“初始化”的session保存到storage中
      }))
    .use(express.static('./public'))
    .use(express.static('./node_modules'))
    .use(router)
    .listen('666',()=>{
        console.log('http://127.0.0.1:666');
    })